<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Running the Wave Reference Server (WRS) on Debian/Ubuntu server</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 5951 2009-05-18 18:03:10Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }
*/

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }
*/

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin: 0 0 0.5em 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left, .figure.align-left{
  clear: left ;
  float: left ;
  margin-right: 1em }

img.align-right, .figure.align-right {
  clear: right ;
  float: right ;
  margin-left: 1em }

.align-left {
  text-align: left }

.align-center {
  clear: both ;
  text-align: center }

.align-right {
  text-align: right }

/* reset inner alignment in figures */
div.align-right {
  text-align: left }

/* div.align-center * { */
/*   text-align: left } */

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font: inherit }

pre.literal-block, pre.doctest-block {
  margin-left: 2em ;
  margin-right: 2em }

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

ul.auto-toc {
  list-style-type: none }

</style>
</head>
<body>
<div class="document" id="running-the-wave-reference-server-wrs-on-debian-ubuntu-server">
<h1 class="title">Running the Wave Reference Server (WRS) on Debian/Ubuntu server</h1>

<div class="section" id="prerequisites">
<h1>Prerequisites</h1>
<ul>
<li><p class="first">You need access to the Debian/Ubuntu server, and permisson to use sudo (default).</p>
</li>
<li><p class="first">If you have a new server, you can optionally install OpenNTPd for time synchronisation
and enable unattended security updates:</p>
<pre class="literal-block">
wget -N http://admin-scripts.googlecode.com/svn/trunk/linux/ubuntu/new-server
cat new-server
sudo sh new-server
</pre>
<ul class="simple">
<li>If you run a JeOS (Just enough OS) edition, you may consider to use the new-jeos
script instead, which also installs OpenSSH, bash completion, man pages and nano.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="installation">
<h1>Installation</h1>
<ul>
<li><p class="first">Get the WRS installation script:</p>
<pre class="literal-block">
wget -N http://admin-scripts.googlecode.com/svn/trunk/linux/ubuntu/install-wave
</pre>
<ul>
<li><p class="first">You may alternatively use the bit.ly shorcut:</p>
<pre class="literal-block">
wget -N http://bit.ly/install-wave
</pre>
</li>
</ul>
</li>
<li><p class="first">Check the available options:</p>
<pre class="literal-block">
sh install-wave --help
</pre>
</li>
<li><p class="first">Install Sun Java 6, Openfire XMPP server and Wave protocol:</p>
<pre class="literal-block">
sudo sh install-wave
</pre>
<ul class="simple">
<li>You can use any available options to override the default settings,
or remove the <cite>sudo</cite> command to install wave for current user only.
The installation script will still need sudo for a few commands though.</li>
<li>For unattended installation you need to accept the Sun Java License
via the <cite>--accept-sun-java-license</cite> option.</li>
<li>Detailed installation protocols are created in the cache directory,
see install-wave options for the specific location.</li>
<li>See also:<ul>
<li><a class="reference external" href="http://jamespurser.com.au/blog/Wave_Reference_Server_-_A_Startup_Guide">http://jamespurser.com.au/blog/Wave_Reference_Server_-_A_Startup_Guide</a></li>
<li><a class="reference external" href="http://code.google.com/p/wave-protocol/wiki/Installation">http://code.google.com/p/wave-protocol/wiki/Installation</a></li>
<li><a class="reference external" href="http://www.onthetopofthewave.com/2009/09/wave-federation-prototype-server/">http://www.onthetopofthewave.com/2009/09/wave-federation-prototype-server/</a></li>
<li><a class="reference external" href="http://groups.google.com/group/wave-protocol">http://groups.google.com/group/wave-protocol</a></li>
</ul>
</li>
</ul>
</li>
<li><p class="first">Configure Openfire server according to the instructions provided by the script.</p>
</li>
</ul>
</div>
<div class="section" id="running">
<h1>Running</h1>
<ul>
<li><p class="first">Run the wave server and the echoy agent:</p>
<pre class="literal-block">
wave-server &gt;&amp;2 2&gt;&gt; ~/wave-server.log &amp;
wave-agent-echoey &gt;&amp;2 2&gt;&gt; ~/wave-agent-echoey.log &amp;
</pre>
<ul class="simple">
<li>Using <cite>sudo</cite> to run them under root is neither needed, nor recommended.</li>
</ul>
</li>
<li><p class="first">Optionally use multitail for WRS and Openfire logspotting:</p>
<pre class="literal-block">
sudo multitail -M 0 ~/wave-server.log --mergeall \
    -ci red /var/log/openfire/error.log \
    -ci yellow /var/log/openfire/warn.log \
    -ci green /var/log/openfire/info.log \
    -ci blue /var/log/openfire/debug.log
</pre>
<ul>
<li><p class="first">Sudo is needed for accessing <cite>/var/log/openfire</cite>.</p>
</li>
<li><p class="first">You may need to install multitail first:</p>
<pre class="literal-block">
sudo aptitude install multitail
sudo sed -i 's/^\(check_mail:\).*/\10/' /etc/multitail.conf    ### disable mail check
</pre>
</li>
<li><p class="first">You may optionally prepend <cite>screen</cite> before the command to run it inside its own screen,
then spawn a working copy of bash (ctrl+a, c) and switch between them (ctrl+a, ctrl+a).
There's also another advantage of using screen: if your ssh conection drops, the programs
started under screen keep running and you can reconnect to them in new session with:</p>
<pre class="literal-block">
screen -DR
</pre>
</li>
</ul>
</li>
<li><p class="first">Run your wave client:</p>
<pre class="literal-block">
wave-client-console $USER
</pre>
</li>
<li><p class="first">List available commands, start a new wave, open it, invite echoey, exchange greets and leave:</p>
<pre class="literal-block">
/
/new
/open 0
/add echoey&#64;type-your-domain-here
Hi!
^D
</pre>
<ul class="simple">
<li>See also:<ul>
<li><a class="reference external" href="http://code.google.com/p/wave-protocol/wiki/ConsoleClient">http://code.google.com/p/wave-protocol/wiki/ConsoleClient</a></li>
</ul>
</li>
</ul>
</li>
<li><p class="first">Check the wave server and the echoy agent processes, and quit them via TERM signal:</p>
<pre class="literal-block">
ps -FC java|grep fedone[-]

kill `ps -FC java|grep fedone[-]|awk '{print $2}'`
</pre>
<ul class="simple">
<li>Bum, your waves are gonna now, they were only kept in memory.</li>
<li>I may update install-wave script to allow running server and agents as deamons
when suitable with later WRS releases.</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="limitations">
<h1>Limitations</h1>
<ul class="simple">
<li>Current WRS version (0.2, as of 2009/09/25) limitations:<ul>
<li>No wave persistence between server restarts (memory only, no RDBMS backend)</li>
<li>No robots or embedding API</li>
</ul>
</li>
<li>Wave installation script todo:<ul>
<li>Other configuration options, like ports (as needed)</li>
<li>Install WRS daemon running under dedicated user (when needed)</li>
<li>Detect if source was actually updated, and rebuild WRS + restart daemon in this case
(if unattended/scheduled updates are needed)
(does not make much sense until waves become persistent between WRS restarts)</li>
<li>Read all default settings from an existing installation, not only XMPP secret key</li>
<li>Pre-configure Openfire (would be only good for fully automatic installations)</li>
<li>Ejabberd support (feel free to implement it if you need it)</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="updating">
<h1>Updating</h1>
<ul class="simple">
<li>Feel free to run the install-wave script anytime to update the WRS.</li>
<li>Currently you need to specify all your custom options again,
except for the XMPP secret key, which is automatically read
from an existing installation.</li>
<li>Currently you also need to manually check the wave-protocol.log
to see if there were any WRS updates and restart the server in that case.</li>
</ul>
</div>
<div class="section" id="federation">
<h1>Federation</h1>
<ul>
<li><p class="first">You need to have an A and a SRV DNS records for your domain (server host FQDN)
and also for a new wave subdomain of it (<cite>wave.</cite> + server host FQDN).</p>
</li>
<li><p class="first">You can use the dig command to check if the records are set to the server IP:</p>
<pre class="literal-block">
sudo aptitude install dnsutils   # install dig command from the dnsutils package

dig +short -t A `hostname --fqdn`
dig +short -t A wave.`hostname --fqdn`

dig +short -t SRV _xmpp-server._tcp.`hostname --fqdn`
dig +short -t SRV _xmpp-server._tcp.wave.`hostname --fqdn`
</pre>
</li>
<li><p class="first">If your server is behind NAT, you also need to forward port 5269 to the server.</p>
</li>
<li><p class="first">See also:</p>
<ul class="simple">
<li><a class="reference external" href="http://code.google.com/p/wave-protocol/wiki/Federation">http://code.google.com/p/wave-protocol/wiki/Federation</a></li>
<li><a class="reference external" href="http://jamespurser.com.au/blog/Federating_Your_Wave_Server">http://jamespurser.com.au/blog/Federating_Your_Wave_Server</a></li>
</ul>
</li>
</ul>
</div>
</div>
</body>
</html>
